import sys
import subprocess
import shutil

# reload(sys)
# sys.setdefaultencoding('utf-8')

# config first
unity_path = "C:\Progra~1\Unity\Editor\Unity.exe"
projectPath = "D:\V-Glass\_developluabranch"
androidExportPath = "D:\V-Glass\_developluabranch\AndroidProjectExport"
executeMethod  = "Build.BuildAndroidProject"
logfile = "./build.log"

cmd = unity_path + " -batchmode " + " -projectPath " + projectPath + " -executeMethod  " + executeMethod
cmd += " -logFile " + logfile 
cmd += " -quit "
# cmd += androidExportPath
print cmd
# why set shell = true https://zhidao.baidu.com/question/651286079254739125.html
subprocess.call(cmd, shell = True)